To be able to edit code and run cells, you need to run the notebook yourself. Where would you like to run the notebook?

This notebook takes about 40 seconds to run.

In the cloud (experimental)

Binder is a free, open source service that runs scientific notebooks in the cloud! It will take a while, usually 2-7 minutes to get a session.

On your computer

(Recommended if you want to store your changes.)

  1. Copy the notebook URL:
  2. Run Pluto

    (Also see: How to install Julia and Pluto)

  3. Paste URL in the Open box

Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

Author 1
👀 Reading hidden code
68.1 μs
👀 Reading hidden code
66.4 μs
👀 Reading hidden code
66.5 μs

📏 Unitful sliders!

👀 Reading hidden code
192 μs
👀 Reading hidden code
using PlutoUI
171 ms
👀 Reading hidden code
@bind x Slider(1:100)
239 ms
1
👀 Reading hidden code
9.9 μs
👀 Reading hidden code
68.2 μs
👀 Reading hidden code
67.5 μs
👀 Reading hidden code
66.6 μs
👀 Reading hidden code
using Unitful
123 ms
1200 m
👀 Reading hidden code
1u"km" + 200u"m"
398 ms
👀 Reading hidden code
66.0 μs
👀 Reading hidden code
69.5 μs
👀 Reading hidden code
65.6 μs
👀 Reading hidden code
80.5 μs

Together!

👀 Reading hidden code
172 μs
@bind f Select([square_area, circle_area])
👀 Reading hidden code
145 ms
@bind diameter Slider((1:20)u"cm")
👀 Reading hidden code
83.2 ms
1 cm^2
f(diameter)
👀 Reading hidden code
12.1 μs
👀 Reading hidden code
67.0 μs
👀 Reading hidden code
66.5 μs
👀 Reading hidden code
65.9 μs
👀 Reading hidden code
66.0 μs
👀 Reading hidden code
65.7 μs
👀 Reading hidden code
66.4 μs

👀 Function slider

👀 Reading hidden code
162 μs

Let's define two functions:

👀 Reading hidden code
169 μs
square_area (generic function with 1 method)
square_area(x) = x^2
👀 Reading hidden code
417 μs
circle_area (generic function with 1 method)
circle_area(x) = π * x^2
👀 Reading hidden code
442 μs
👀 Reading hidden code
68.3 μs
👀 Reading hidden code
66.2 μs

We can slide through a list of functions!

👀 Reading hidden code
170 μs
square_area (generic function with 1 method)
f
👀 Reading hidden code
9.5 μs
👀 Reading hidden code
66.4 μs
👀 Reading hidden code
65.5 μs
👀 Reading hidden code
65.5 μs
👀 Reading hidden code
65.3 μs
👀 Reading hidden code
67.8 μs

Want to learn more?

Pluto.jl is an open source, interactive programming environment for Julia, designed for teachers.

Try it out today! plutojl.org

👀 Reading hidden code
322 μs